package com.itheima.mapper;

import com.itheima.pojo.CheckItem;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface CheckItemMapper {
    @Insert("insert into t_checkitem(name,sex,age,price,type,remark,attention) values(#{name},#{sex},#{age},#{price},#{type},#{remark},#{attention})")
    @Options(useGeneratedKeys = true, keyProperty = "id")
    int addCheckItem(CheckItem checkItem);

    int insert(CheckItem checkItem);

    List<CheckItem> findAll();
@Delete("delete from t_checkitem where id = #{id}")
    int delete(Integer id);

    int update(CheckItem checkItem);
    List<CheckItem> findByCode(String code, int offset, int pageSize);
    int countByCode(String code);

    List<CheckItem> findByName(String name, int offset, int pageSize);
    int countByName(String name);

@Select("select * from t_checkitem where id = #{id}")
    CheckItem findById(Integer id);

    List<CheckItem> findPage(int offset, int pageSize);

    long count();
}

